import { request3 } from './request'

export function getRestaurants(args) {
 
  let config = {
    url: '/restaurants',
    params: {
      latitude: args.latitude,
      longitude: args.longitude,
      'extras[]': 'activities',
      'restaurant_category_ids[]': args.id,
      order_by: args.oderBy,
      'delivery_mode[]': args.delivery_mode,
      support_ids: []
    }
  }
  
  if(args.selectTag) {
    for (let i = 0; i < args.selectTag.length; i++) {
      config.params['support_ids'][i] = args.selectTag[i]
    }
  }

  return request3(config)
}

export function getFoodSort(latitude, longitude) {
  return request3({
    url: '/v2/restaurant/category',
    params: {
      latitude,
      longitude
    }
  })
}

export function getDeliveryModes(latitude, longitude) {
  return request3({
    url: '/v1/restaurants/delivery_modes',
    params: {
      latitude,
      longitude
    }
  })
}

export function getActivityAttributes(latitude, longitude) {
  return request3({
    url: '/v1/restaurants/activity_attributes',
    params: {
      latitude,
      longitude
    }
  })
}


